<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of GoogleEventView
 *
 * @author Mubashar
 */
class GoogleEventView {
    //put your code here
    
    public function  getEvent()
    {}
    
    public function getEventList($param) 
            {
    $param = "test";
    
    }
    
    public function insertEvent(array $salesForceEvent) {
        //Map Sales Force Event to Google Event here and Add
    }
    
    public function deletetEvent(array $salesForceEvent) {
        //Map Sales Force Event to Google Event here and Add
    }
    
    public function updateEvent(array $salesForceEvent) {
        //Map Sales Force Event to Google Event here and Add
    }
    
    //<editor-fold>
    //Maps Sales force object into Google Object and return google event object here.
    //</editor-fold>
    public static function createGoogleEventFromSalesForceEvent(SalesforceEventPoco $salesforceEvent, $calendarId) {
        
        $googleEventObject = new GoogleEvent();
            
            $googleEventObject->start_Date = $salesforceEvent->getActivityDate();
            $googleEventObject->start_DateTime = $salesforceEvent->getActivityDateTime();
            $googleEventObject->description = $salesforceEvent->getSubject();
            $googleEventObject->end_Date = $salesforceEvent->getEndDateTime();
            $googleEventObject->end_DateTime = $salesforceEvent->getEndDateTime();
            $googleEventObject->IsAllDayEvent = $salesforceEvent->getIsAllDayEvent();
            $googleEventObject->IsRecurrence = $salesforceEvent->getIsRecurrence();
            $googleEventObject->IsReminderSet = $salesforceEvent->getIsReminderSet();
            $googleEventObject->location = $salesforceEvent->getLocation();
            //$googleEventObject->reminderDateTime =
            // TODO(Moon): Get ReminderDateTime.
            $googleEventObject->showAs =  $salesforceEvent->getShowAs(); //$objevent->transparency == "transparent" ? "free" : "busy";
            $googleEventObject->calender_Id = $calendarId;
            $googleEventObject->summary = $salesforceEvent->getDescription();
            $googleEventObject->Type = "Meeting";
            $googleEventObject->WhoId = $salesforceEvent->getWhoId();
            
            $salesFoceAttendee = new SalesForceEventAttendeePoco();
            $salesFoceAttendee = $salesforceEvent->getAttendees();
            foreach ($salesFoceAttendee as $key) {
                $attendee = new EventAttendee();
                //$attendee->comment;
                $attendee->displayName=$key->Name;
                //$attendee->self;
                $attendee->responseStatus=$key->Status;
                //$attendee->additionalGuests;
                //$attendee->resource;
                //$attendee->organizer;
                //$attendee->optional;
                $attendee->email=$key->AttendeeId;
                
                
//    public $Id;
//    public $EventId;
//    public $AttendeeId;
//    public $Status;
//    public $RespondedDate;
//    public $Response;
//    public $LastModifiedDate;
//    public $IsDeleted;
//    public $Name;
                array_push($googleEventObject->attendees, $attendee);
                //$googleEventObject->attendees->push($attendee);
            }
            //$googleEventObject->attendees = $salesforceEvent->getAttendees();
            $googleEventObject->updated = CalendarSyncController::getCurrentGMTTime();
            return $googleEventObject;
        
    }
}   

?>
